package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StuOption;
import com.itheima.service.EmpService;
import com.itheima.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private EmpService empService;
    @Autowired
    private StudentService studentService;

    @GetMapping("/empJobData")
    public Result empCount() {
        JobOption jobOption = empService.empCount();
        log.info("员工职位统计");
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result genderCount() {
        List<Map> mapList = empService.genderCount();
        log.info("员工性别统计");
        return Result.success(mapList);
    }

    @GetMapping("studentDegreeData")
    public Result stuDegreeCount() {
        List<Map> stuMap = studentService.stuDegreeCount();
        log.info("学历统计");
        return Result.success(stuMap);
    }

    @GetMapping("/studentCountData")
    public Result stuCount() {
        StuOption stuOption = studentService.stuCount();
        log.info("学生人数统计");
        return Result.success(stuOption);
    }
}


